//
//  ImageViewController.m
//  Pods
//
//  Created by Yuns on 2017/8/1.
//
//

#import "ImageViewController.h"

@interface ImageViewController ()

@end

@implementation ImageViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setupSubviews];
}

- (void)setupSubviews {
    UIImageView *imgView1 = [[UIImageView alloc] init];
    imgView1.frame = CGRectMake(0, 80, self.view.frame.size.width, 100);
    imgView1.backgroundColor = [UIColor lightGrayColor];
    imgView1.contentMode = UIViewContentModeScaleAspectFit;
    [self.view addSubview:imgView1];
    
    UIImageView *imgView2 = [[UIImageView alloc] init];
    imgView2.frame = CGRectMake(0, CGRectGetMaxY(imgView1.frame) + 60, self.view.frame.size.width, 100);
    imgView2.backgroundColor = [UIColor lightGrayColor];
    imgView2.contentMode = UIViewContentModeScaleAspectFit;
    [self.view addSubview:imgView2];
    
    UILabel *plistLabel = [[UILabel alloc] init];
    plistLabel.frame = CGRectMake(0, CGRectGetMaxY(imgView2.frame) + 60, self.view.frame.size.width, 120);
    plistLabel.numberOfLines = 0;
    [self.view addSubview:plistLabel];
    
    // 加载图片方式带缓存
    NSBundle *bundle = [NSBundle bundleWithURL:[[NSBundle bundleForClass:self.class] URLForResource:@"YsModuleSrc" withExtension:@"bundle"]];
    UIImage *image1 = [UIImage imageNamed:@"huanche_nor_icon" inBundle:bundle compatibleWithTraitCollection:nil];
    //UIImage *image2 = [UIImage imageNamed:@"timg.jpeg" inBundle:bundle compatibleWithTraitCollection:nil];
    // 加载图片方式不带缓存
    NSString *imgPath = [bundle pathForResource:@"timg.jpeg" ofType:nil];
    UIImage *image2 = [UIImage imageWithContentsOfFile:imgPath];
    // 根据路径加载文件
    NSString *plistPath = [bundle pathForResource:@"ParamsList.plist" ofType:nil];
    NSDictionary *plistDict = [[NSDictionary alloc] initWithContentsOfFile:plistPath];
    
    imgView1.image = image1;
    imgView2.image = image2;
    plistLabel.text = plistDict.description;
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
